package summer_vacation.shilaihong.threeday;

import java.util.Scanner;

/**
 * Created by alh on 2015/9/5.
 */
public class N20 {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in );
        String Str =cin.nextLine();
        int m=0,n=0;
        for(int i=0;i<Str.length();i++) {
            char c=Str.charAt(i);
            if(c>='a'&&c<='z') n++;
            else if(c>='A'&&c<='Z') m++; }
        if(n>m) {System.out.print(n);
        } else System.out.print(m); }
}
